#ifndef _RANGEN_H_
#define _RANGEN_H_

#define RAND_N 624
#define RAND_M 397
#define RAND_MATRIX_A 0x9908b0df
#define RAND_UPPER_MASK 0x80000000
#define RAND_LOWER_MASK 0x7fffffff

#define RAND_TEMPERING_MASK_B 0x9d2c5680
#define RAND_TEMPERING_MASK_C 0xefc60000
#define RAND_TEMPERING_SHIFT_U(y)	(y >> 11)
#define RAND_TEMPERING_SHIFT_S(y)	(y << 7 )
#define RAND_TEMPERING_SHIFT_T(y)	(y << 15)
#define RAND_TEMPERING_SHIFT_L(y)	(y >> 18)

class RanGen
{
	unsigned int	rseed;
	unsigned int	mt[RAND_N];
	int				mti;

public:
	RanGen(void);

	int				Random(int min, int max);
	void			SeedRandom(unsigned int n);
	unsigned int	GetRandomSeed(void);
	void			SeedRandom(void);
};

#endif